package com.eedi.framework.oauth2.dal.mapper;

import com.eedi.framework.mybatis.core.mapper.BaseMapperX;
import com.eedi.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.eedi.framework.oauth2.dal.dataobject.SysOAuth2RefreshTokenDO;
import org.apache.ibatis.annotations.Mapper;

@Mapper
public interface SysOAuth2RefreshTokenMapper extends BaseMapperX<SysOAuth2RefreshTokenDO> {

    default int deleteByRefreshToken(String refreshToken) {
        return delete(new LambdaQueryWrapperX<SysOAuth2RefreshTokenDO>()
                .eq(SysOAuth2RefreshTokenDO::getRefreshToken, refreshToken));
    }

    default SysOAuth2RefreshTokenDO selectByRefreshToken(String refreshToken) {
        return selectOne(SysOAuth2RefreshTokenDO::getRefreshToken, refreshToken);
    }

}
